home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / Timer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  3.5 KB  |  136 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Timer.h
  3.  
  4.      Contains:    Time Manager interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1985-1993, 1995-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __TIMER__
  19. #define __TIMER__
  20.  
  21. #ifndef __CONDITIONALMACROS__
  22. #include <ConditionalMacros.h>
  23. #endif
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. #ifndef __OSUTILS__
  28. #include <OSUtils.h>
  29. #endif
  30.  
  31.  
  32.  
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=mac68k
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52.  
  53.  
  54. enum {
  55.                                                                 /* high bit of qType is set if task is active */
  56.     kTMTaskActive                = (1L << 15)
  57. };
  58.  
  59. typedef struct TMTask                     TMTask;
  60. typedef TMTask *                        TMTaskPtr;
  61. typedef CALLBACK_API( void , TimerProcPtr )(TMTaskPtr tmTaskPtr);
  62. /*
  63.     WARNING: TimerProcPtr uses register based parameters under classic 68k
  64.              and cannot be written in a high-level language without 
  65.              the help of mixed mode or assembly glue.
  66. */
  67. typedef REGISTER_UPP_TYPE(TimerProcPtr)                         TimerUPP;
  68. struct TMTask {
  69.     QElemPtr                         qLink;
  70.     short                             qType;
  71.     TimerUPP                         tmAddr;
  72.     long                             tmCount;
  73.     long                             tmWakeUp;
  74.     long                             tmReserved;
  75. };
  76.  
  77.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  78.                                                                                             #pragma parameter InsTime(__A0)
  79.                                                                                             #endif
  80. EXTERN_API( void )
  81. InsTime                            (QElemPtr                 tmTaskPtr)                            ONEWORDINLINE(0xA058);
  82.  
  83.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  84.                                                                                             #pragma parameter InsXTime(__A0)
  85.                                                                                             #endif
  86. EXTERN_API( void )
  87. InsXTime                        (QElemPtr                 tmTaskPtr)                            ONEWORDINLINE(0xA458);
  88.  
  89.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  90.                                                                                             #pragma parameter PrimeTime(__A0, __D0)
  91.                                                                                             #endif
  92. EXTERN_API( void )
  93. PrimeTime                        (QElemPtr                 tmTaskPtr,
  94.                                  long                     count)                                ONEWORDINLINE(0xA05A);
  95.  
  96.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  97.                                                                                             #pragma parameter RmvTime(__A0)
  98.                                                                                             #endif
  99. EXTERN_API( void )
  100. RmvTime                            (QElemPtr                 tmTaskPtr)                            ONEWORDINLINE(0xA059);
  101.  
  102. EXTERN_API( void )
  103. Microseconds                    (UnsignedWide *            microTickCount)                        FOURWORDINLINE(0xA193, 0x225F, 0x22C8, 0x2280);
  104.  
  105. enum { uppTimerProcInfo = 0x0000B802 };                         /* register no_return_value Func(4_bytes:A1) */
  106. #define NewTimerProc(userRoutine)                                 (TimerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTimerProcInfo, GetCurrentArchitecture())
  107. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  108.     #pragma parameter CallTimerProc(__A0, __A1)
  109.     void CallTimerProc(TimerUPP routine, TMTaskPtr tmTaskPtr) = 0x4E90;
  110. #else
  111.     #define CallTimerProc(userRoutine, tmTaskPtr)                 CALL_ONE_PARAMETER_UPP((userRoutine), uppTimerProcInfo, (tmTaskPtr))
  112. #endif
  113.  
  114.  
  115.  
  116. #if PRAGMA_STRUCT_ALIGN
  117.     #pragma options align=reset
  118. #elif PRAGMA_STRUCT_PACKPUSH
  119.     #pragma pack(pop)
  120. #elif PRAGMA_STRUCT_PACK
  121.     #pragma pack()
  122. #endif
  123.  
  124. #ifdef PRAGMA_IMPORT_OFF
  125. #pragma import off
  126. #elif PRAGMA_IMPORT
  127. #pragma import reset
  128. #endif
  129.  
  130. #ifdef __cplusplus
  131. }
  132. #endif
  133.  
  134. #endif /* __TIMER__ */
  135.  
  136.